package cn.gov.pbc.dream.pojo.dto.user.bankfinancing.org;

import cn.gov.pbc.dream.common.ServerResponse;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

@Data
@ToString
public class AddOrgDto {

    private String orgCode;

    private String orgName;

    public ServerResponse validate() {
        if(StringUtils.isBlank(orgCode)){
            return ServerResponse.createByErrorMessage("机构编码不能为空");
        }
        if(StringUtils.isBlank(orgName)){
            return ServerResponse.createByErrorMessage("机构名称不能为空");
        }
        if(orgCode.length() != 6){
            return ServerResponse.createByErrorMessage("机构编码长位不符合要求");
        }
        return ServerResponse.createBySuccess();
    }
}
